# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-sphinxcontrib-gravatar
_pkgname=sphinxcontrib-gravatar
pkgver=0.1.2
pkgrel=8
pkgdesc="Sphinx gravatar extension"
options="!check" # Most tests fail
url="https://pypi.org/project/sphinxcontrib-gravatar"
arch="noarch"
license="BSD-2-Clause"
depends="python3 py3-sphinx"
makedepends="py3-setuptools py3-gpep517"
checkdepends="py3-pytest py3-pytest-cov py3-mock"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

replaces="py-sphinxcontrib-gravatar" # Backwards compatibility
provides="py-sphinxcontrib-gravatar=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
18f68ab2259a85fe33bf76c9c6c98eed2b196b33a5a3fe04bb481f4df37b653473aeca1bf58871164dc60cf82d7225b62bade9993d825356f6450bca9d8f2980  sphinxcontrib-gravatar-0.1.2.tar.gz
"
